package com.yanqu.backendweb.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yanqu.backendweb.bean.GamePropsDto;
import com.yanqu.backendweb.service.impl.GamePropServiceImpl;
import com.yanqu.backendweb.utils.Response;
import com.yanqu.backendweb.utils.Utils;
import com.yanqu.road.utils.ConfigHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.SortedMap;
import java.util.TreeMap;

/**
 * @author duli
 * @version 1.0
 * @date 2020/10/13 9:38
 * @Description 游戏道具
 */
@Controller
@RequestMapping("/gameProps")
public class GamePropsController {
    private final static Logger log = LoggerFactory.getLogger(GamePropsController.class);
    @Autowired
    private GamePropServiceImpl gamePropService;
    @RequestMapping("/get")
    @ResponseBody
    public Response get(String requestId, String sign){
        SortedMap<String, Object> paramMap = new TreeMap<>();
        paramMap.put("requestId",requestId);
        boolean flag= Utils.checkSign(paramMap,sign);
        if(flag){
            GamePropsDto propsDto=gamePropService.getGameProps();
            return Response.success(propsDto);
        }else{
            return Response.singError();
        }

    }
}
